/**
 *  @author lemmar@lu.unisi.ch & zulianp@lu.unisi.ch
 */

package ch.unisi.inf.projects.java.uom.gui.commands;

import java.awt.event.ActionEvent;
import ch.unisi.inf.projects.java.uom.gui.itemeditor.multimedia.PhotoPanel;
import ch.unisi.inf.projects.java.uom.elements.Photo;
import ch.unisi.inf.projects.java.uom.elements.ItemManager;

public final class PhotoPanelEraseCommand extends Command {
	
	/** We are not going to serialize this class atm */
	private static final long serialVersionUID = -1L;
	
	final PhotoPanel panel;
	
	public PhotoPanelEraseCommand (final PhotoPanel panel)
	{
		super();
        putValue(NAME,"Delete Photo");
        putValue(SHORT_DESCRIPTION,"Deletes aa photo");
        this.panel = panel;
        // edit
	}
    
    public void actionPerformed(final ActionEvent ev)
    {  
    	final Photo photo = panel.getContent();
    	panel.removeContent();
    	ItemManager.instance().multimediaDelete(photo);
    	fireActionPerformed();
    }
}